﻿import request from '/@/utils/request';
enum Api {
  AddCustomer = '/api/customer/add',
  DeleteCustomer = '/api/customer/delete',
  UpdateCustomer = '/api/customer/update',
  PageCustomer = '/api/customer/page',
  DetailCustomer = '/api/customer/detail',
  DownloadExcelTemplate = '/api/customer/downloadExcelTemplate',
  ImportDataCus = '/api/customer/ImportDataCus',
  UserList = '/api/sysUser/list',
  BatchDelete = '/api/customer/batchDelete',
  BatchCollectMoney = '/api/customer/batchCollectMoney',
}

// 增加客户档案表
export const addCustomer = (params?: any) =>
	request({
		url: Api.AddCustomer,
		method: 'post',
		data: params,
	});

// 删除客户档案表
export const deleteCustomer = (params?: any) => 
	request({
			url: Api.DeleteCustomer,
			method: 'post',
			data: params,
		});

// 编辑客户档案表
export const updateCustomer = (params?: any) => 
	request({
			url: Api.UpdateCustomer,
			method: 'post',
			data: params,
		});

// 分页查询客户档案表
export const pageCustomer = (params?: any) => 
	request({
			url: Api.PageCustomer,
			method: 'post',
			data: params,
		});

// 详情客户档案表
export const detailCustomer = (id: any) => 
	request({
			url: Api.DetailCustomer,
			method: 'get',
			data: { id },
		});


// 下载模板
export const downloadTemplate= () => 
	request({
			url: Api.DownloadExcelTemplate,
			method: 'get',
			responseType:'blob',
		});


export const importDataCus = (file?: any) =>
request({
	url: Api.ImportDataCus,
	method: 'post',
	data: file,
	headers:{'Content-Type': ''}
});


export const getUserList = () => 
	request({
			url: Api.UserList,
			method: 'get',
	      });


//批量删除
export const batchDelete = (params?: any) => 
	request({
			url: Api.BatchDelete,
			method: 'post',
			data: params,
		});

//批量收款
export const batchCollectMoney = (params?: any) => 
	request({
			url: Api.BatchCollectMoney,
			method: 'post',
			data: params,
		});
		